package org.smile.design.proxy.cglib;

import net.sf.cglib.proxy.InvocationHandler;

import java.lang.reflect.Method;

public class Midgard implements InvocationHandler {
    private Ship target;

    public Midgard(Ship ship){
        this.target = ship;
    }

    @Override
    public Object invoke(Object o, Method method, Object[] objects) throws Throwable {
        System.out.println(o.getClass());
        System.out.println(method.toString());
        Object result = method.invoke(target, objects);
        if (result instanceof Ship)
            System.out.println("yes yes yes");
        return result;
    }
}
